import requests from './request'
//http://gmall-h5-api.atguigu.cn/api/product/getBaseCategoryList
import mockRequests from './mockAjax'
//三级联动接口 get 无参数
///api/product/getBaseCategoryList

export const reqCategoryList = () => {
    return requests({
        url: '/product/getBaseCategoryList',
        method: 'get'
    })
}
export const reqGetBannerList = () => {

    return mockRequests({
        url: '/banner',
        method: 'get'
    })
}
export const reqFloorList = () => {

    return mockRequests({
        url: '/floor',
        method: 'get'
    })
}
export const reqGetSearch = ( params) => {

    return requests({
        url: '/list',
        method: 'post',
        data:params
    })
}
//产品详情接口
export const reqGoodsInfo = ( skuId) => {

    return requests({
        url: `/item/${skuId}`,
        method: 'get',
    })
}
//将产品添加到购物车中||修改某一个产品数目
export const reqAddorUpdateShopCart = ( skuId,skuNum) => {
    return requests({
        url: `/cart/addToCart/${skuId}/${skuNum}`,
        method: 'post',
    })
}
//获取购物车数据的接口
export const reqCartList = ( skuId,skuNum) => {

    return requests({
        url: `/cart/cartList`,
        method: 'get',
    })
}
//删除购物车数据的接口
export const reqDeleteCartById = ( skuId) => {

    return requests({
        url: `/cart/deleteCart/${skuId}`,
        method: 'delete',
    })
}
//修改商品选中状态
export const reqUpdateCheckedById = ( skuId,isChecked) => {

    return requests({
        url: `/cart/checkCart/${skuId}/${isChecked}`,
        method: 'get',
    })
}
//获取验证码
export const reqGetCode = ( phone) => {

    return requests({
        url: `/user/passport/sendCode/${phone}`,
        method: 'get',
    })
}
//注册接口
export const reqUserRegister = ( data) => {
    return requests({
        url: `/user/passport/register`,
        data,
        method: 'post',
    })
}
//登陆接口
export const reqUserLogin = ( data) => {
    return requests({
        url: `/user/passport/login`,
        data,
        method: 'post',
    })
}
//获取用户信息
export const reqUserInfo = () => {
    return requests({
        url: `/user/passport/auth/getUserInfo`,
        method: 'get',
    })
}
//退出登录
export const reqUserLogout = () => {
    return requests({
        url: `/user/passport/logout`,
        method: 'get',
    })
}
//获取用户地址信息
export const reqAddressInfo = () => {
    return requests({
        url: `/user/userAddress/auth/findUserAddressList`,
        method: 'get',
    })
}
//获取用户商品清单
export const reqOrderInfo = () => {
    return requests({
        url: `/order/auth/trade`,
        method: 'get',
    })
}
//提交订单的接口
export const reqSubmitOrder = (tradeNo,data) => {
    return requests({
        url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
        method: 'post',
        data
    })
}
//获取支付信息
export const reqPayInfo = (orderId) => {
    return requests({
        url: `/payment/weixin/createNative/${orderId}`,
        method: 'get',
    })
}
//获取支付状态/api/payment/weixin/queryPayStatus/{orderId}
export const reqPayStatus = (orderId) => {
    return requests({
        url: `/payment/weixin/queryPayStatus/${orderId}`,
        method: 'get',
    })
}
//获取个人中心数据（只包含我的订单）
export const reqMyOrderList = (page,limit) => {
    return requests({
        url: `/order/auth/${page}/${limit}`,
        method: 'get',
    })
}